<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var isSymmetric = function (root) {
      const traversal = (left, right) => {

        if (!left && !right) {
          return true
        }
        console.log(left.val, right.val);
        if (!left || !right || left.val !== right.val) {
          return false
        }
        console.log(left.val, right.val);

        return traversal(left.left, right.right) && traversal(left.right, right.left)
      }
      return traversal(root, root)
    };
    console.log(isSymmetric(root = [1, 2, 2, 3, 4, 5, 3]))
  </script>

</body>

</html>